#include<bits/stdc++.h>
using namespace std;

int n,m;
int a[100015],c[100015];
long long ans;

int main(){
	freopen("arena.in","r",stdin);
	freopen("arena.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=m;i++){
		scanf("%d",&c[i]);
	}
	ans=1;
	for(int i=2;i<=m;i++){
		ans=ans^i;
	}
	printf("%lld\n",ans);
	return 0;
}